import asyncio
import random
import time
import fastapi
from typing import Optional
import threading
from fastapi import FastAPI

app = FastAPI()


@app.get("/async")
async def sleep_async():
    await asyncio.sleep(10)
    return {}


@app.get("/sync")
def sleep_sync():
    print('start sync', threading.get_ident(), threading.get_native_id())
    time.sleep(10)
    return {}

